1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module adw.ToastOverlay;
26 
27 private import adw.Toast;
28 private import adw.c.functions;
29 public  import adw.c.types;
30 private import glib.ConstructionException;
31 private import gobject.ObjectG;
32 private import gtk.AccessibleIF;
33 private import gtk.AccessibleT;
34 private import gtk.BuildableIF;
35 private import gtk.BuildableT;
36 private import gtk.ConstraintTargetIF;
37 private import gtk.ConstraintTargetT;
38 private import gtk.Widget;
39 
40 
41 /**
42  * A widget showing toasts above its content.
43  * 
44  * <picture>
45  * <source srcset="toast-overlay-dark.png" media="(prefers-color-scheme: dark)">
46  * <img src="toast-overlay.png" alt="toast-overlay">
47  * </picture>
48  * 
49  * Toasts can be shown with [method@ToastOverlay.add_toast].
50  * 
51  * See [class@Toast] for details.
52  * 
53  * ## CSS nodes
54  * 
55  * ```
56  * toastoverlay
57  * ├── [child]
58  * ├── toast
59  * ┊   ├── label.heading
60  * ├── [button]
61  * ╰── button.circular.flat
62  * ```
63  * 
64  * `AdwToastOverlay`'s CSS node is called `toastoverlay`. It contains the child,
65  * as well as zero or more `toast` subnodes.
66  * 
67  * Each of the `toast` nodes contains a `label` subnode with the `.heading`
68  * style class, optionally a `button` subnode, and another `button` subnode with
69  * `.circular` and `.flat` style classes.
70  * 
71  * ## Accessibility
72  * 
73  * `AdwToastOverlay` uses the `GTK_ACCESSIBLE_ROLE_TAB_GROUP` role.
74  *
75  * Since: 1.0
76  */
77 public class ToastOverlay : Widget
78 {
79 	/** the main Gtk struct */
80 	protected AdwToastOverlay* adwToastOverlay;
81 
82 	/** Get the main Gtk struct */
83 	public AdwToastOverlay* getToastOverlayStruct(bool transferOwnership = false)
84 	{
85 		if (transferOwnership)
86 			ownedRef = false;
87 		return adwToastOverlay;
88 	}
89 
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)adwToastOverlay;
94 	}
95 
96 	/**
97 	 * Sets our main struct and passes it to the parent class.
98 	 */
99 	public this (AdwToastOverlay* adwToastOverlay, bool ownedRef = false)
100 	{
101 		this.adwToastOverlay = adwToastOverlay;
102 		super(cast(GtkWidget*)adwToastOverlay, ownedRef);
103 	}
104 
105 
106 	/** */
107 	public static GType getType()
108 	{
109 		return adw_toast_overlay_get_type();
110 	}
111 
112 	/**
113 	 * Creates a new `AdwToastOverlay`.
114 	 *
115 	 * Returns: the new created `AdwToastOverlay`
116 	 *
117 	 * Since: 1.0
118 	 *
119 	 * Throws: ConstructionException GTK+ fails to create the object.
120 	 */
121 	public this()
122 	{
123 		auto __p = adw_toast_overlay_new();
124 
125 		if(__p is null)
126 		{
127 			throw new ConstructionException("null returned by new");
128 		}
129 
130 		this(cast(AdwToastOverlay*) __p);
131 	}
132 
133 	/**
134 	 * Displays @toast.
135 	 *
136 	 * Only one toast can be shown at a time; if a toast is already being displayed,
137 	 * either @toast or the original toast will be placed in a queue, depending on
138 	 * the priority of @toast. See [property@Toast:priority].
139 	 *
140 	 * Params:
141 	 *     toast = a toast
142 	 *
143 	 * Since: 1.0
144 	 */
145 	public void addToast(Toast toast)
146 	{
147 		adw_toast_overlay_add_toast(adwToastOverlay, (toast is null) ? null : toast.getToastStruct());
148 	}
149 
150 	/**
151 	 * Gets the child widget of @self.
152 	 *
153 	 * Returns: the child widget of @self
154 	 *
155 	 * Since: 1.0
156 	 */
157 	public Widget getChild()
158 	{
159 		auto __p = adw_toast_overlay_get_child(adwToastOverlay);
160 
161 		if(__p is null)
162 		{
163 			return null;
164 		}
165 
166 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
167 	}
168 
169 	/**
170 	 * Sets the child widget of @self.
171 	 *
172 	 * Params:
173 	 *     child = the child widget
174 	 *
175 	 * Since: 1.0
176 	 */
177 	public void setChild(Widget child)
178 	{
179 		adw_toast_overlay_set_child(adwToastOverlay, (child is null) ? null : child.getWidgetStruct());
180 	}
181 }